- Experimental Design
- Power analyses
- Multi-factor ANOVA
- Nested ANOVA
- Factorial ANOVA
- Analysis of CoVariance (ANCOVA)
11/06/2018
Survival of climbers of Mount Everest is higher for individuals taking supplemental oxygen than those who don’t.
Why?
The goal of experimental design is to eliminate bias and to reduce sampling error when estimating and testing effects of one variable on another.
\[ Power \propto \frac{(ES)(\alpha)(\sqrt n)}{\sigma}\]
Power is proportional to the combination of these parameters
perc <- read.table('perchlorate_data.tsv', header=T, sep='\t')
x <- perc$Strain
y <- log10(perc$T4_Hormone_Level)
MyANOVA <- aov(y ~ x)
summary (MyANOVA)
boxplot(y ~ x)
Based on your results, calculate the power for your ANOVA.
pwr.t2n.test(n1=xxx, n2=xxx, d=xxx, sig.level=.05, power=NULL)
Check out the functions in the ‘pwr’ library (Unnecessary in this case, but could use ANOVA version):
pwr.anova.test(k=2, n=190, f=0.25, sig.level=.05, power=NULL)
Each pair of dots represents the two measurements
andrew_data <- read.table('andrew.tsv', header=T, sep=‘\t')
head(andrew_data)
andrew_data$TREAT2 <- factor(c(rep(“low”,40),rep(“high”,40))
andrew_data$PATCH <- factor(andrew_data$PATCH)
andrew.agg <- with(andrew_data, aggregate(data.frame(ALGAE),
by = list(TREAT2=TREAT2, PATCH=PATCH), mean)
library(nlme)
andrew.agg <- gsummary(andrew_data, groups=andrew_data$PATCH)
boxplot(ALGAE ~ TREAT2, andrew.agg)
nested.aov <- aov(ALGAE ~ TREAT2 + Error(PATCH), data=andrew_data) summary(nested.aov)
library(nlme) VarCorr(lme(ALGAE ~ 1, random = ~1 | TREAT2/PATCH, andrew_data))
rnadata <- read.table('RNAseq.tsv', header=T, sep='')
head(rnadata)
gene <- rnadata$Gene80 microbiota <- rnadata$Microbiota genotype <- rnadata$Genotype boxplot(gene ~ microbiota) boxplot(gene ~ genotype) boxplot(gene ~ microbiota*genotype)
rna_aov <- aov(gene ~ microbiota + genotype + microbiota:genotype) rna_aov <- aov(gene ~ microbiota*genotype)
plot(rna_aov) summary(rna_aov) anova(rna_aov)